import os
import shutil

def delete_target_folders(root_dir):
    for root, dirs, files in os.walk(root_dir, topdown=False):
        for name in dirs:
            if name == 'target':
                target_folder = os.path.join(root, name)
                print("Deleting", target_folder)
                shutil.rmtree(target_folder)

root_directory = '.'
delete_target_folders(root_directory)